package sctu.edu.java.year2016.team01.chenhong.day20160522.chapter6_2;

/**
 * Created by Administrator on 2016/5/22.
 * 用for和if删除空格
 */
public class Delete {
    public static void main(String[] args) {

        String s = "we are students";


        char[] news = new char[s.length()];
        int i = 0;


        for (int j = 0; j < s.length(); j++) {
            if (s.charAt(j) != ' ') {
                news[i] = s.charAt(j);
                i++;
            }
        }


        System.out.println(news);
    }
}